#include "../include/cglobal.h"


#define N 100

int getMaxSubArray(int s[],int n){
	int start,end,i;
	int sum ,max;
	sum = max =0;	
	start = end = 0;
	for(i=0;i<n;i++){
		if(sum < 0){
			start = i;
			sum = 0;
			printf("for i= %d,reset to zero!\n",i);
		}
		sum  +=s[i];
		if(sum > max){
			max = sum;
			end = i;
			printf("now max = %d,and end = %d\n",max,end);
		}
	}
	printf("the max of the sub array is :%d ,starting from %d to %d\n",max,start,end);
	return 0;
}

int main(){
	int n,s[N];
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++){
		scanf("%d",s+i);
	}
	getMaxSubArray(s,n);
	return 0;
}


